﻿namespace ExceptionsHandling
{
    using System;

    class TryCatchFinally
    {
        // 1.2.11.01. Write a program that reads an integer number and calculates and prints its square root.
        // If the number is invalid or negative, print "Invalid number". In all cases finally print "Good bye".
        // Use try-catch-finally.

        static void Main()
        {
            try
            {
                uint num = uint.Parse(Console.ReadLine());
                Console.WriteLine(Math.Sqrt(num));
            }
            catch (FormatException)
            {
                Console.WriteLine("Invalid number");
            }
            catch (OverflowException)
            {
                Console.WriteLine("Invalid number");
            }
            finally
            {
                Console.WriteLine("Good bye");
            }
        }
    }
}